package com.tianji.learning.mapper;

import com.tianji.learning.domain.po.LearningLesson;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 学生课程表 Mapper 接口
 * </p>
 *
 * @author yp
 * @since 2024-07-19
 */
public interface LearningLessonMapper extends BaseMapper<LearningLesson> {


    @Select("select * from learning_lesson where user_id = #{userId} and status =1 order by latest_learn_time desc limit 0,1")
    LearningLesson queryCurrent(@Param("userId") Long userId);


    @Select("select count(*) from learning_lesson where course_id = #{courseId} ")
    Integer selectcourseSum(@Param("courseId") Long courseId);


    @Select("SELECT sum(week_freq) from learning_lesson WHERE user_id = #{userId} and plan_status =1 and `status` in (0,1)")
    Integer queryWeekTotalPlan(Long userId);

}
